package com.chixing.controller;

import com.chixing.service.CollectionService;
import com.chixing.util.ServerResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping("collection")
public class CollectionController {
    @Autowired
    private CollectionService collectionService;
    //根据用户id看是否有没有收藏
    @GetMapping("/isCollection")
    @ResponseBody
    public ServerResponse isCollectionByCustId(@RequestParam Integer custId){
        return collectionService.isCollectionByCustId(custId);
    }

    @PostMapping("/addCollection")
    @ResponseBody
    public ServerResponse addCollection(@RequestParam Integer custId,
                                        @RequestParam Integer sightsId){
        return collectionService.addCollection(custId,sightsId);
    }

    @GetMapping("/isNotesCollection")
    @ResponseBody
    public ServerResponse isNotesCollectionByCustId(@RequestParam Integer custId){
        return collectionService.isNotesCollectionByCustId(custId);
    }

    @PostMapping("/addNotesCollection")
    @ResponseBody
    public ServerResponse addNotesCollection(@RequestParam Integer custId,
                                        @RequestParam Integer notesId){
        return collectionService.addNotesCollection(custId,notesId);
    }
}
